<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>紫色鹭</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/style.css">
    <style>


    </style>
    <script src="../js/config.js"></script>
</head>
<body>
<div class="get_html">
    <div class="search_head" v-cloak>
        <div class="container">
            <div class="clearfix">
                <div class="logo" onclick="location.href = 'index.html'"><img src="../img/logo_01.png" alt=""></div>
                <div class="search_center">
                    <div class="search_box">
                        <input type="text" placeholder="" onkeydown="toSearch(event)">
                        <button>搜索</button>
                    </div>
                    <!--<div class="hot">-->
                    <!--<a target="_blank"  href="">康明斯</a>-->
                    <!--<a target="_blank"  href="">康明斯</a>-->
                    <!--<a target="_blank"  href="">康明斯</a>-->
                    <!--<a target="_blank"  href="">康明斯</a>-->
                    <!--<a target="_blank"  href="">康明斯</a>-->
                    <!--</div>-->
                </div>
                <div class="my_shopcar">
                    <i class="icon_shopcar"></i>我的购物车<span class="car-num">0</span></i>
                </div>
            </div>
            <div class="tab_box">
                <div class="tab_01_box">
                    <div class="title">
                        全部商品分类
                    </div>
                    <ul class="tab_01">
                        <li class="first-data" v-for="first in classList">{{first.name}}
                            <i class="icon_right_white"></i>
                            <div class="show-content">
                                <div class="first-c"><span class="first-text">{{first.name}}</span></div>
                                <div v-for="second in first.subordinate" class="second-sty1">
                                    <span class="icon_right icon-sty2"></span>
                                    <a target="_blank"  class="second-data go-list">{{second.name}}</a>
                                    <div class="cont">
                                        <a target="_blank"  class="third-data go-list"
                                           v-for="third in second.subordinate">{{third.name}}</a>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                    <div class="tab_02">

                    </div>
                </div>
                <div class="list">
                    <a target="_blank"  href="index.html">首页</a>
                    <a target="_blank"  href="product_list.html">产品</a>
                    <a target="_blank">公司</a>
                    <a target="_blank">资讯</a>
                    <a target="_blank">论坛</a>
                    <!--<a target="_blank"  href="my_order.html" v-show="type==2?true:false">我的订单</a>-->
                    <!--<a target="_blank"  href="Submission.html" v-show="type==2?false:true">我要开店</a>-->
                    <a target="_blank" v-if="Token"  href="http://www.ziselu.com/purple_heron_merchants">我的店铺</a>


                </div>
            </div>
        </div>
    </div>
    <script>
        //js写入html中，以便赋值回父页面
        $("body").on("click", ".search_head .search_center .search_box button", function () {
            var name = $(".search_head .search_center .search_box input").val();
            location.href = "product_list.html?name=" + name;
        })
        function toSearch() {
            if (event.keyCode == "13") {
                var name = $(".search_head .search_center .search_box input").val();
                location.href = "product_list.html?name=" + name;
            }
        }
        //    //取出html代码重新赋值父页面search_head
        $(document).on("click", ".go-list", function () {
            var name = $(this).html();
            location.href = "product_list.html?type=" + name;
        })
        $(".search_head .search_center .search_box input").val(getUrlParam("name"))
    </script>
</div>

</body>
<script src="../js/config.js"></script>
<script>
    var nowDate = new Date().getTime();
    var app_sh = new Vue({
        el: '.search_head',
        data: {
            classList: localStorage.getItem("allClass") && (nowDate - localStorage.getItem("classTime")) < 180000?JSON.parse(localStorage.getItem("allClass")):'',
            type: localStorage.getItem('type'),
            Token:Token,
        },
        beforeCreate: function () {
            var _this = this;
            //分类
            if(!(localStorage.getItem("allClass") && (nowDate - localStorage.getItem("classTime")) < 180000)){
                ajax_async("sys/storeCommodityType/getAllList", {}, function (data) {
                    _this.classList = data;
                    localStorage.setItem("classTime",nowDate);
                    localStorage.setItem("allClass",JSON.stringify(data));
                })
            }
        },
        updated: function () {
            var get_html = $(".get_html").html();
            var _iframe = window.parent;
            var _div = _iframe.document.getElementById('head_search_html');
            $(_div).html(get_html);

        },
        mounted: function () {
            if(localStorage.getItem("allClass") && (nowDate - localStorage.getItem("classTime")) < 180000){
                var get_html = $(".get_html").html();
                var _iframe = window.parent;
                var _div = _iframe.document.getElementById('head_search_html');
                $(_div).html(get_html);
            }
        },
    })




</script>
</html>